package org.example.yidaiyilu.entity;

import java.util.ArrayList;
import java.util.List;

public class YiXiang {


    private String cixing =null;

    private String zh_shiyi = null;

    private String zhuyi = null;

    private Shili shili = null;

    private BianXi bianxi = null;

    private List<CiTiao> citiaoList =new ArrayList<CiTiao>();
    public void setCitiaoList(List<CiTiao> citiaoList) {
        this.citiaoList = citiaoList;
    }

    public List getCitiaoList() {
        return this.citiaoList;
    }

    public void setCixing(String cixing) {
        this.cixing = cixing;
    }

    public void setZh_shiyi(String zh_shiyi) {
        this.zh_shiyi = zh_shiyi;
    }



    public void setZhuyi(String zhuyi) {
        this.zhuyi = zhuyi;
    }

    public void setShili(String shili) {
        if(shili!=null&&!"".equals(shili)) {
            this.shili = new Shili(shili);
        }
    }

    public void setBianxi(String text) {
        this.bianxi = new BianXi(text);
    }

    public String toString(){
        StringBuilder sb = new StringBuilder();
        sb.append("<义项>");
        if(cixing != null && !"".equals(cixing)){
            sb.append("<词性>").append(cixing).append("</词性>");
        }
        if(zh_shiyi != null && !"".equals(zh_shiyi)){
            sb.append("<释义>").append(zh_shiyi).append("</释义>");
        }

        if(zhuyi != null && !"".equals(zhuyi)){
            sb.append("<注意>").append(zhuyi.replace("◎","")).append("</注意>");
        }

        if(shili != null){
            sb.append(shili.toString());
        }

        if(bianxi != null && !"".equals(bianxi)){
            sb.append(bianxi.toString());
        }
        for(int i=0; i<citiaoList.size(); i++){
            sb.append(citiaoList.get(i).toString());
        }
        sb.append("</义项>");
        return sb.toString();
    }
}
